package com.iflytek.day09;

import java.util.Arrays;

public class Test6_2 {
    public static void main(String[] args) {

        //1.整数转字符串，遍历字符串，放置到新的数组中
        int number = 12345;
        String numStr = String.valueOf(number);
        int[] numArr = new int[numStr.length()];
        for (int i = 0; i < numStr.length(); i++) {
            numArr[i] = Integer.parseInt(String.valueOf(numStr.charAt(i)));
        }

        //验证结果  1  2  3  4 5
        for (int i = 0; i < numArr.length; i++) {
            System.out.print(numArr[i] + " ");
        }
    }
}